home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 July: Mac OS SDK / Dev.CD Jul 96 SDK / Dev.CD Jul 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / Table / Sources / Tracker.h < prev   
Encoding:
Text File  |  1996-04-25  |  5.1 KB  |  192 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Tracker.h
  4. //    Release Version:    $ ODF 1 $ 
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef TRACKER_H
  11. #define TRACKER_H
  12.  
  13. #ifndef PART_H
  14. #include "Part.h"
  15. #endif
  16.  
  17. #ifndef CELL_H
  18. #include "Cell.h"
  19. #endif
  20.  
  21. #ifndef CONSTANT_H
  22. #include "Constant.h"
  23. #endif
  24.  
  25. // ----- ODF Includes -----
  26.  
  27. #ifndef FWTRACKR_H
  28. #include "FWTrackr.h"
  29. #endif
  30.  
  31. // ----- OS Includes -----
  32.  
  33. #ifndef FWLINSHP_H
  34. #include "FWLinShp.h"
  35. #endif
  36.  
  37. #ifndef FWRECT_H
  38. #include "FWRect.h"
  39. #endif
  40.  
  41. //========================================================================================
  42. //    Forward declarations
  43. //========================================================================================
  44.  
  45. class CTablePart;
  46. class CTableFrame;
  47. class CTableContent;
  48. class CTableSelection;
  49.  
  50. //========================================================================================
  51. //    class CTableDropTracker
  52. //========================================================================================
  53.  
  54. class CTableDropTracker : public FW_CDropTracker
  55. {
  56. //----------------------------------------------------------------------------------------
  57. //    Initialization/Destruction
  58. //
  59. public:
  60.     CTableDropTracker(Environment* ev, 
  61.                 CTablePart* part,
  62.                 CTableContent* content,
  63.                 CTableFrame* frame,
  64.                 ODFacet* facet,
  65.                 const CCell& sourceCell);
  66.     virtual ~CTableDropTracker();
  67.     
  68. //----------------------------------------------------------------------------------------
  69. //    New API
  70. //
  71. public:    
  72.     // ----- Tracking -----
  73.     virtual FW_CPoint     BeginTracking(Environment* ev, 
  74.                             const FW_CPoint& anchorPoint);
  75.     virtual FW_CPoint     ContinueTracking(Environment* ev,
  76.                             const FW_CPoint& anchorPoint, 
  77.                             const FW_CPoint& previousPoint, 
  78.                             const FW_CPoint& currentPoint);
  79.  
  80. private:
  81.     void                Hilite(Environment* ev, const CCell& cell, ODFacet* facet);
  82.     FW_Boolean            ShouldHilite(Environment* ev, const FW_CPoint& anchorPoint, CCell& cell);
  83.     
  84. //----------------------------------------------------------------------------------------
  85. //    Data Members
  86. //
  87. private:
  88.     CTableFrame*        fTableFrame;
  89.     CTablePart*            fTablePart;
  90.     CTableContent*        fTableContent;
  91.     CCell                fSourceCell;
  92.     CCell                fCurCell;
  93.     FW_Boolean            fHiliteOn;
  94. };
  95.  
  96. //========================================================================================
  97. //    class CCrossShape
  98. //========================================================================================
  99.  
  100. class CCrossShape
  101. {
  102. //---------------------------------------------------------------------------------------
  103. //    Constructors/Destructors
  104. //
  105.   public:
  106.     CCrossShape(const FW_CPoint& brCell, FW_CPoint& brFrm);
  107.  
  108. //---------------------------------------------------------------------------------------
  109. //    Public API
  110. //
  111.   public:
  112.     void    SetHLineToMove();
  113.     void    SetVLineToMove();
  114.  
  115.     // ----- Rendering -----
  116.     void    Render(FW_CGraphicContext& graphicContext);
  117.  
  118.     // ----- Transform -----
  119.     void    MoveShape(FW_Fixed deltaX, FW_Fixed deltaY);
  120.  
  121. //---------------------------------------------------------------------------------------
  122. //    Data Members
  123. //
  124.   private:
  125.     FW_CLineShape        vLine;
  126.     FW_CLineShape        hLine;
  127. };
  128.  
  129. //========================================================================================
  130. //    class CGridLineTracker
  131. //========================================================================================
  132.  
  133. class CGridLineTracker : public FW_CTracker
  134. {
  135.   public:
  136.     CGridLineTracker(Environment* ev, 
  137.                      FW_CView* view,
  138.                      ODFacet* facet,
  139.                      ETableLoc tl,
  140.                      FW_CRect dragArea,
  141.                      FW_CPoint borders);
  142.     virtual ~CGridLineTracker();
  143.  
  144. //----------------------------------------------------------------------------------------
  145. //    Required Overrides
  146. //
  147.   public:
  148.     virtual FW_CPoint     BeginTracking(Environment* ev, 
  149.                                     const FW_CPoint& anchorPoint);
  150.     virtual FW_CPoint     ContinueTracking(Environment* ev,
  151.                                     const FW_CPoint& anchorPoint, 
  152.                                     const FW_CPoint& previousPoint, 
  153.                                     const FW_CPoint& currentPoint);
  154.     virtual FW_Boolean     EndTracking(Environment* ev,
  155.                                     const FW_CPoint& anchorPoint, 
  156.                                     const FW_CPoint& lastPoint);
  157.  
  158. //----------------------------------------------------------------------------------------
  159. //    Accessor Functions
  160. //
  161.   public:
  162.     const FW_CPoint&    GetOldBorders();
  163.     const FW_CPoint&    GetNewBorders();
  164.  
  165. //----------------------------------------------------------------------------------------
  166. //    Data Members
  167. //
  168.   private:
  169.     FW_Boolean            fHorizMove;        // resize horizontally?
  170.     FW_Boolean            fVertMove;        // resize vertically?
  171.     FW_CRect            fDragArea;        // permissible drag area
  172.     FW_CPoint            fOldBorders;
  173.     FW_CPoint            fNewBorders;
  174.     CCrossShape            fCross;            // cursor
  175. };
  176.  
  177. //========================================================================================
  178. //    CGridLineTracker Inlines
  179. //========================================================================================
  180.  
  181. inline const FW_CPoint& CGridLineTracker::GetOldBorders()
  182.     return fOldBorders; 
  183. }
  184.  
  185. inline const FW_CPoint& CGridLineTracker::GetNewBorders()
  186.     return fNewBorders; 
  187. }
  188.  
  189. #endif
  190.